package com.shangke.corejava.ch13;

public class Test2 implements Runnable {
	private int begin;
	private int end;

	public Test2() {
		super();
	}

	public Test2(int max, int min) {
		super();
		this.begin = max;
		this.end = min;
	}

	public int getMax() {
		return begin;
	}

	public void setMax(int max) {
		this.begin = max;
	}

	public int getMin() {
		return end;
	}

	public void setMin(int min) {
		this.end = min;
	}

	// 重写方法
	@Override
	public void run() {
		for (int i = begin; i <= end; i++) {
			int j = 2;
			for (j = 2; j <= i; j++) {
				if (i % j == 0) {
					break;
				}
			}
			if (i == j) {
				System.out.println(i);
			}
		}
	}

	// 调用
	public static void main(String[] args) {
		Test2 test1 = new Test2(1, 1000);
		Thread thread = new Thread(test1);
		thread.start();

		Test2 test2 = new Test2(1001, 2000);
		Thread thread2 = new Thread(test2);
		thread2.start();

		Test2 test3 = new Test2(2001, 3000);
		Thread thread3 = new Thread(test3);
		thread3.start();

	}

}
